package com.example.springboot3.controller;

import com.example.springboot3.util.I18nUtil;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张琪
 * @date 2024-02-21 17:43
 */
@RestController
@Slf4j
@RequestMapping("/user")
public class FirstUserController {

    @Resource
    private HttpServletRequest request;

    @RequestMapping("/i18n")
    public String first() {
        String message1 = I18nUtil.getMessage("A00001", request.getHeader("lang"));
        String message2 = I18nUtil.getMessage("A00002", request.getHeader("lang"));
        return message1 + message2;
    }
}
